package com.carey.yygh.hosp.config;

import com.carey.yygh.rabbit.constant.MqConst;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {
    @Bean
    public Queue Orderqueue(){
        return new Queue(MqConst.QUEUE_ORDER,true);
    }
    @Bean
    public DirectExchange Orderexchange(){
        return new DirectExchange(MqConst.EXCHANGE_DIRECT_ORDER);
    }
    @Bean
    public Binding MsmexchangebindMsmqueue(){
        return BindingBuilder.bind(Orderqueue()).to(Orderexchange()).with(MqConst.ROUTING_ORDER);
    }
}
